
  <script>
    layui.use('layer', function(){ //独立版的layer无需执行这一句
        var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句

        //触发事件
        var active = {
            confirmTrans: function(){

                $.ajax({
                    type:"POST",
                    url: "../index/loginout",
                    dataType:"text",
                    success:function(datas){
                        //layer.msg(datas);
                        if(datas==1){
                            layer.msg('退出成功!');
                            setTimeout(parent.location.reload(),1000);
                        }
                    }
                });

            }
        };

        $('#layerDemo .layui-btn').on('click', function(){
            var othis = $(this), method = othis.data('method');
            active[method] ? active[method].call(this, othis) : '';
        });

    });
</script>
